/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package data;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;

/**
 *
 * @author Stratos
 */
public class Station {

    String name;
    Date date;
    Double income;
    Integer regulars;
    Integer students;
    Integer soldiers;
    Station prev;
    Station next;
    //Integer ticketNo;
    ArrayList<TicketMachine> machines;
    SimpleDateFormat ft;

    public Station(String name, Integer machineNumber) {
        this.date = new Date();
        ft = new SimpleDateFormat("dd/MM/yyyy");
        machines = new ArrayList();
        this.name = name;
        for (int i = 1; i <= machineNumber; i++) {
            TicketMachine machine = new TicketMachine(this.name, i);
            machines.add(machine);
        }

    }

    public void board(Passenger p) {
        String type = p.getType();
        String d = ft.format(this.date);
        if (type.equalsIgnoreCase("Regular")) {
            System.out.println("[" + d + " - " + this.name + "]"
                    + " Επιβίβαση κανονικού επιβάτη");
        } else if (type.equalsIgnoreCase("Student")) {
            System.out.println("[" + d + " - " + this.name + "]"
                    + " Επιβίβαση φοιτητή");
        } else if (type.equalsIgnoreCase("Soldier")) {
            System.out.println("[" + d + " - " + this.name + "]"
                    + " Επιβίβαση Στρατιώτη");
        }

    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public String toString() {
        return this.getName();
    }
}
